package com.young.weixin.model.message;

import com.young.common.util.JsonUtil;
import com.young.weixin.util.WxConstants;

import java.util.Map;

/**
 * 微信消息入参map包装类
 * 避免使用map.get()来取参数, 看着不得劲
 *
 * @author wangjiyu
 * @date 2021/10/5 22:40
 */
public class WxMessageMapWrapper {

    /**
     * 微信传过来的消息xml转为的map
     */
    private Map<String, String> messageMap;

    public WxMessageMapWrapper(Map<String, String> messageMap) {
        this.messageMap = messageMap;
    }

    public Map<String, String> getMessageMap() {
        return messageMap;
    }

    @Override
    public String toString() {
        return JsonUtil.toJson(messageMap);
    }

    public void setMessageMap(Map<String, String> messageMap) {
        this.messageMap = messageMap;
    }



    public String getToUserName() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.TO_USER_NAME);
    }

    public String getFromUserName() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.FROM_USER_NAME);
    }

    public String getCreateTime() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.CREATE_TIME);
    }

    public String getMsgType() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.MSG_TYPE);
    }

    public String getMsgId() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.MSG_ID);
    }

    public String getContent() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.CONTENT);
    }

    public String getPicUrl() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.PIC_URL);
    }

    public String getMediaId() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.MEDIA_ID);
    }

    public String getTitle() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.TITLE);
    }

    public String getDescription() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.DESCRIPTION);
    }

    public String getUrl() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.URL);
    }

    public String getLocationX() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.LOCATION_X);
    }

    public String getLocationY() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.LOCATION_Y);
    }

    public String getLabel() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.LABEL);
    }

    public String getScale() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.SCALE);
    }

    public String getThumbMediaId() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.THUMB_MEDIA_ID);
    }

    public String getFormat() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.FORMAT);
    }

    public String getRecognition() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.RECOGNITION);
    }

    public String getEvent() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.EVENT);
    }
    public String getEventKey() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.EVENT_KEY);
    }
    public String getTicket() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.TICKET);
    }

    public String getLatitude() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.LATITUDE);
    }
    public String getLongitude() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.LONGITUDE);
    }
    public String getPrecision() {
        return messageMap.get(WxConstants.WX_MESSAGE_KEYS.PRECISION);
    }
}
